import { Param } from "./types";

export const Flake8TidyImportsParamList: Param[] = [
    {
        name: "ban-relative-imports",
        descEn: `Whether to ban all relative imports ("all"), or only those imports that extend into the parent module or beyond ("parents").`,
        descCn: "",
        defaultValue: "parents",
        optionList: ["parents", "all"],
        url: 'https://beta.ruff.rs/docs/settings/#ban-relative-imports',
    },
    {
        name: "banned-api",
        descEn: "Specific modules or module members that may not be imported or accessed. Note that this rule is only meant to flag accidental uses, and can be circumvented via eval or importlib.",
        descCn: "",
        defaultValue: {},
        url: 'https://beta.ruff.rs/docs/settings/#banned-api',
        validValue: (value: unknown) => {
            if (typeof value !== "object") {
                return "配置值必须是一个对象";
            }
            for (const v of Object.values(value as object)) {
                if (typeof v !== "object") {
                    return "对象值必须是对象";
                }
                for (const av of Object.values(v)) {
                    if (typeof av !== "string") {
                        return "子对象值必须是字符串";
                    }
                }
            }
            return null;
        },
    },
];